package com.zr.serviceimpl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zr.dao.ShowEIRDao;
import com.zr.model.Creceipt;
import com.zr.service.ShowEIRService;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
 * lxg
 * @author Administrator
 *
 */
@Service("shEIRseim")
public class ShowEIRServiceImpl implements ShowEIRService{
	@Resource
	private ShowEIRDao shEIRdaim;
	@Override
	public JSONObject getReceipt(int page,int rows) {
		JSONObject jo=new JSONObject();
		JSONArray ja=new JSONArray();
		
		List<Creceipt>li=shEIRdaim.findReceipt(page, rows);
		for (Creceipt creceipt : li) {
			JSONObject j=new JSONObject();
			j.put("reid", creceipt.getReid());
			j.put("seid", creceipt.getCsealing().getSeid());
			//j.put("oid", creceipt.getCorder().getOid());
			j.put("goodsname", creceipt.getCorder().getGoodsname());
			j.put("restartp", creceipt.getRestartp());
			j.put("reendp", creceipt.getReendp());
			j.put("redate", creceipt.getRedate());
			j.put("crid", creceipt.getCcarreport().getCcarinfo().getCnumber());
			j.put("did", creceipt.getCdriver().getDname());
			//j.put("uid", creceipt.getCuser().getUname());
			ja.add(j);
		}
		jo.put("rows", ja);
		jo.put("total", shEIRdaim.getcount());
		return jo;
	}

}
